package utils

import (
	"fmt"
	"github.com/shopspring/decimal"
)

func Add(a, b float64) float64 {
	v, ok := decimal.NewFromFloat32(float32(a)).Add(decimal.NewFromFloat32(float32(b))).Float64()
	if !ok {
		fmt.Println("decimal Add failed")
	}
	return v
}

func Sub(a, b float64) float64 {
	v, ok := decimal.NewFromFloat32(float32(a)).Sub(decimal.NewFromFloat32(float32(b))).Float64()
	if !ok {
		fmt.Println("decimal Sub failed")
	}
	return v
}

func Div(a, b float64) float64 {
	v, ok := decimal.NewFromFloat32(float32(a)).Div(decimal.NewFromFloat32(float32(b))).Float64()
	if !ok {
		fmt.Println("decimal Div failed")
	}
	return v
}

func Mul(a, b float64) float64 {
	v, ok := decimal.NewFromFloat32(float32(a)).Mul(decimal.NewFromFloat32(float32(b))).Float64()
	if !ok {
		fmt.Println("decimal Mul failed")
	}
	return v
}
